package com.pangolin.pangolinim.ui.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.orhanobut.logger.Logger;
import com.pangolin.pangolinim.R;
import com.pangolin.pangolinim.ui.adapter.UIContact;
import com.pangolin.pangolinim.ui.base.BaseActivity;
import com.pangolin.pangolinim.utils.BundleUtil;
import com.pangolin.pangolinim.utils.GsonUtil;
import com.pangolin.pangolinim.utils.UIUtil;

public class AddFriendActivity extends BaseActivity {
    private UIContact me;
    private LinearLayout mLlSearchUser;
    private TextView mTvAccount;

    @Override
    protected void init(){
        String strContact = getIntent().getStringExtra("param1");
        if(strContact != null){
            me = GsonUtil.fromJson(strContact , UIContact.class);
            Logger.d("contact:%d|%s" , me.getUid() , me.getName());
        }
    }

    @Override
    protected void initView(){
        setToolbarTitle(UIUtil.getString(R.string.add_friend));
        mLlSearchUser = findViewById(R.id.llSearchUser);
        mTvAccount = findViewById(R.id.tvAccount);
        mTvAccount.setText(String.valueOf(me.getUid()));
    }

    @Override
    protected void initListener(){
        mLlSearchUser.setOnClickListener(v -> jumpToActivity(SearchUserActivity.class , GsonUtil.toJson(me)));


    }

    @Override
    protected void CoreMessage(BundleUtil bundleUtil){

    }

    @Override
    protected int provideContentViewId(){
        return R.layout.activity_add_friend;
    }
}